home *** CD-ROM | disk | FTP | other *** search
- function checkCollision(mc2, mc1, tolerance, scope)
- {
- var _loc1_ = classes.CollisionDetection.checkForCollision(mc1,mc2,255);
- return _loc1_;
- }
- var scope = _parent;
- var tolerance = 120;
- onEnterFrame = function()
- {
- if(this.hitTest(_parent[_root.userCar].target_mc))
- {
- if(checkCollision(this,_parent[_root.userCar]) != undefined || checkCollision(this,_parent[_root.userCar]) != null)
- {
- _root.crash_snd.start();
- _parent[_root.userCar].hit = true;
- _parent[_root.userCar].speed = (- _parent[_root.userCar].speed) * 1.5;
- _parent[_root.userCar].vector[0] = - _parent[_root.userCar].vector[0];
- _parent[_root.userCar].vector[1] = - _parent[_root.userCar].vector[1];
- _parent[_root.userCar]._x += _parent[_root.userCar].vector[0] += (Math.cos(_parent[_root.userCar].angle) * _parent[_root.userCar].speed - _parent[_root.userCar].vector[0]) / _parent[_root.userCar].traction;
- _parent[_root.userCar]._y += _parent[_root.userCar].vector[1] += (Math.sin(_parent[_root.userCar].angle) * _parent[_root.userCar].speed - _parent[_root.userCar].vector[1]) / _parent[_root.userCar].traction;
- }
- else
- {
- _parent[_root.userCar].hit = false;
- }
- }
- else
- {
- _parent[_root.userCar].hit = false;
- }
- };
-